package com.sinosoft.sm.system.role.manager;

import java.util.List;

import com.sinosoft.sm.system.role.dao.RoleEntityMapper;
import com.sinosoft.sm.system.role.entity.RoleEntity;
import com.sinosoft.sm.system.role.entity.UserRoleRefEntity;
import com.sinosoft.sm.system.role.manager.api.RoleManager;

/**
 * 用户角色管理实现类
 * @author leichao
 */
public class RoleManagerImpl implements RoleManager {

	private RoleEntityMapper roleEntityMapper;
	
	public void setRoleEntityMapper(RoleEntityMapper roleEntityMapper) {
		this.roleEntityMapper = roleEntityMapper;
	}

	/**
	 * 
	 * 根据用户名获取用户的角色关联信息
	 */
	public List<UserRoleRefEntity> getRolesByUser(String username) {
		return roleEntityMapper.getRolesByUser(username);
	}

	/**
	 * 
	 * 获取所有角色信息
	 */
	public List<RoleEntity> getAllRoels() {
		return roleEntityMapper.getAllRoles();
	}

	/**
	 * 添加用户角色信息
	 */
	public void addRoleRef(UserRoleRefEntity roleRef) {
		// TODO Auto-generated method stub
		roleEntityMapper.addRoleRef(roleRef);
	}

}
